import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";

export type CustomRouteMeta = {
  title: string;
  [key: string]: any;
};

declare module "vue-router" {
  export interface RouteMeta extends CustomRouteMeta {}
}

const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    redirect: "/MySpace",
  },
  {
    path: "/MySpace",
    name: "MySpace",
    meta: { title: "个人中心" },
    component: () =>
      import(/* webpackChunkName: "MySpace" */ "@/views/MySpace/MySpace.vue"),
  },
  {
    path: "/Home",
    name: "Home",
    meta: { title: "Home" },
    component: () => import(/* webpackChunkName: "Home" */ "@/views/Home.vue"),
  },
  {
    path: "/About",
    name: "About",
    meta: { title: "About" },
    component: () =>
      import(/* webpackChunkName: "About" */ "@/views/About.vue"),
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
